package com.atde._05_behavioral_design_patterns.memento.game;


/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._05_behavioral_design_patterns.memento.game
 * @Author: Del
 * @CreateTime: 2025-06-30  02:50
 * @Description: 客户端 -- 测试
 * @Version: 1.0
 */
public class Client {
    public static void main(String[] args) {
        // 创建游戏角色
        GameRole gameRole = new GameRole();
        System.out.println("游戏角色初始状态：");
        gameRole.show();
        // 保存当前角色状态
        Caretaker caretaker = new Caretaker();
        caretaker.setMemento(gameRole.createMemento());
        System.out.println("已保存游戏角色状态");
        gameRole.setVit(85);
        gameRole.setDef(95);
        System.out.println("游戏角色当前状态：");
        gameRole.show();
        System.out.println("恢复游戏角色状态");
        gameRole.recoverMemento(caretaker.getMemento());
        System.out.println("游戏角色当前状态：");
        gameRole.show();
    }
}
